package texxs;
/*class Animal
{
    public int age=3;
    public String name="wang";
    //public String name;

}
class Dog extends Animal
{
    public int age=4;
    public String silly;
    public void dayin()
    {
        System.out.println(super.age);
    }
    public Dog()
    {

        this.silly = "笨";
    }


}



public class text {
    public static void main(String[] args) {
        Dog dog=new Dog();
       dog.dayin();

    }

}

 */
class Animal
{
    public int age;
    //public String name="wang";
    public String name;
    public Animal()
    {


        System.out.println("给父类初始化");
    }

    public void eat()
    {
        System.out.println(name + "正在吃饭");
    }
    public void dance()
    {
        System.out.println("狗在跳舞");
    }
}
class Dog extends Animal
{
    public String silly;
    public Dog()
    {
        super();//默认调用父类的无参构造方法，且必须放在第一行，
        //this.silly = "聪明";
        System.out.println("给子类初始化");
    }

    //public String name;

    public void bark()
    {
        super.dance();
        System.out.println(name + "正在叫");
    }


}
public class text{
    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println(dog.silly);
        System.out.println(dog.age);
        System.out.println(dog.name);


    }
}
